package org.itli.jnsocket.Mapper;

import org.apache.ibatis.annotations.*;
import org.itli.jnsocket.Pojo.WareHouse;

import java.util.List;

@Mapper
public interface WareHouseMapper {

    //获取全部仓库
    @Select("select * from jn_wms_warehouse LIMIT #{size} OFFSET #{page}")
    List<WareHouse> selectAll(int size, int page);

    //添加仓库
    @Insert("INSERT INTO jn_wms_warehouse (warehouse_name, warehouse_code, remark, create_by, update_by) VALUES" +
            "(#{warehouse.warehouse_name}, #{warehouse.warehouse_code}, #{warehouse.remark}, #{create_by}, #{update_by})")
    int AddWH(WareHouse warehouse,String create_by,String update_by);

    //修改仓库信息
    @Update("UPDATE jn_wms_warehouse SET warehouse_name = #{warehouse.warehouse_name}, remark = #{warehouse.remark}, update_by = #{update_by}, update_time = NOW() , warehouse_code = #{warehouse.warehouse_code} WHERE id = #{warehouse.id} ")
    int UpdateWH(WareHouse warehouse,String update_by);

    //删除仓库
    @Delete("delete from jn_wms_warehouse where id = #{id} ")
    void Delete(int id);

}
